<template>
  <view bg="#fff" h-100rpx w-full px-40rpx box-border flex items-center justify-between>
    <view flex items-center>
      <image :src="aiInfo.headUrl" w-80rpx h-80rpx rounded-full></image>
      <view class="flex flex-col">
        <text class="ml-20rpx" text-28rpx font-500>{{ aiInfo.name }}</text>
        <text class="ml-20rpx" text-20rpx text="#68696B">在线</text>
      </view>
    </view>
    <view flex items-center>
      <!-- <view w-85rpx h-85rpx flex items-center justify-center @click="toRealtime">
        <image w-36rpx h-36rpx src="@/pages/funcPages/static/aiChat/phone.png"></image>
      </view> -->
      <view v-if="aiInfo.isShowOpenSound" w-85rpx h-85rpx flex items-center justify-center>
        <!-- 开启状态 -->
        <image v-if="aiInfo.isOpenSound" w-36rpx h-36rpx src="@/pages/funcPages/static/aiChat/sound_open.png" @click="emit('openSound', 1)"></image>
        <!-- 关闭状态 -->
        <image v-else w-36rpx h-36rpx src="@/pages/funcPages/static/aiChat/sound.png" @click="emit('openSound', 2)"></image>
      </view>
      
      <view w-85rpx h-85rpx flex items-center justify-center>
        <image w-36rpx h-36rpx src="@/pages/funcPages/static/aiChat/plus.png" @click="emit('createSession')"></image>
      </view>
      <view
        w-85rpx
        h-85rpx
        flex
        items-center
        justify-center
        @click="$navigateTo('/pages/funcPages/aiChat/historyMessage')">
        <image w-40rpx h-36rpx src="@/pages/funcPages/static/aiChat/record.png"></image>
      </view>
    </view>
  </view>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { createConversation } from '@/api/aiChat'
import storage from '@/utils/storage'
const props = defineProps({
  aiInfo: {
    type: Object,
    default: () => ({})
  }
})
const emit = defineEmits(['createSession', 'openSound'])
// const isOpenSound = ref(uni.getStorageSync('isOpenSound'))
function toRealtime () {
  uni.navigateTo({
    url: '/pages/funcPages/aiChat/realtime'
  })
}
onMounted(() => {})
</script>

<style lang="scss" scoped></style>
